$('#connectdelports').click(function () {
        var ports = [ ];
         $("input[name='order_checkbox']:checked").each(function () {
          var tr = $(this).parent().parent();
          var port_name = tr.children("td#port_name").text();
          ports.push(port_name);
      });
   if (ports.length == 0){
      alert('请至少勾选一个');
   }
   else {
      $('#portconnectdel').val(ports);
      $('#portconnectdelModal').modal('show');
   }
    });

$('#batchdelports').click(function () {
        var ports = [ ];
         $("input[name='order_checkbox']:checked").each(function () {
          var tr = $(this).parent().parent();
          var port_name = tr.children("td#port_name").text();
          ports.push(port_name);
      });
   if (ports.length == 0){
      alert('请至少勾选一个');
   }
   else {
      $('#portbatchdel').val(ports);
      $('#portbatchdelModal').modal('show');
   }
    });

$("#checkAll").click(function () {
        if (this.checked) {
            $("input[name='order_checkbox']").each(function () {
                this.checked = true;
            });
        } else {
            $("input[name='order_checkbox']").each(function () {
                this.checked = false;
            });
        }
    }
);
  function editport(obj) {
    var tr = $(obj).parent().parent();
    var port_name = tr.children("td#port_name").text();
    var port_type = tr.children("td#port_type").text();
    var port_status = tr.children("td#port_status").text();
    var connect_device = tr.children("td#connect_networkdevice").text();
    var connect_port = tr.children("td#connect_port").text();
    var connect_server = tr.children("td#connect_server").text();
    var connect_user = tr.children("td#connect_user").text();
    $('#port_nametext').val(port_name);
    if (port_type == "网络设备互联") {
      $(".selector").val("0");
    } else if (port_type == "服务器互联") {
      $(".selector").val("1");
    } else if (port_type == "客户互联") {
      $(".selector").val("2");
    } else if (port_type == "待定") {
      $(".selector").val("3");
    };
    if (port_status == "运营") {
      $("#port_statustext").val("0");
    } else if (port_status == "闲置") {
      $("#port_statustext").val("1");
    } else if (port_status == "故障") {
      $("#port_statustext").val("2");
    };
    $('#connect_devicetext').val(connect_device);
    $('#connect_porttext').val(connect_port);
    $('#connect_servertext').val(connect_server);
    $('#connect_usertext').val(connect_user);
    $('#portedit').modal('show');
  };
  function delport(obj) {
    var tr = $(obj).parent().parent();
    var port_name = tr.children("td#port_name").text();
    $('#delport_name').val(port_name);
    $('#portdelModal').modal('show');
  };
